package com.deimos.dataBase;

import java.util.Date;

public class Unavailability {
	long start;
	long stop;
	long knownAbout;
	/**
	 * @return the start
	 */
	public long getStart() {
		return start;
	}
	/**
	 * @param start the start to set
	 */
	public void setStart(long start) {
		this.start = start;
	}
	/**
	 * @return the stop
	 */
	public long getStop() {
		return stop;
	}
	/**
	 * @param stop the stop to set
	 */
	public void setStop(long stop) {
		this.stop = stop;
	}
	/**
	 * @return the knownAbout
	 */
	public long getKnownAbout() {
		return knownAbout;
	}
	/**
	 * @param knownAbout the knownAbout to set
	 */
	public void setKnownAbout(long knownAbout) {
		this.knownAbout = knownAbout;
	}
	
	public String toString(String token){
		String text = "";
		text = text + token + "<Unavailabiltiy>" + "\n";
		text = text +token + "\t<Start>" + this.start + "</Start>\n";
		text = text +token + "\t<Stop>" + this.stop + "</Stop>\n";
		text = text +token + "\t<KnownAbout>" + this.knownAbout + "</KnownAbout>\n";
		text = text +token + "</Unavailabiltiy>";
		return text;
	}
	
	public Date getStartTime(Date initDate){
		return new Date(initDate.getTime() + secondsToMiliseconds(this.start)); 
	}
	
	public Date getStopTime(Date initDate){
		return new Date(initDate.getTime() + secondsToMiliseconds(this.stop)); 
	}
	
	public Date getKnownTime(Date initDate){
		return new Date(initDate.getTime() + secondsToMiliseconds(this.knownAbout)); 
	}
	
	public long secondsToMiliseconds(long seconds){
		return seconds * 1000;
	}
}

